class Solution:
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if not strs: return ""
        # 按照字符串的顺序返回值
        for a in strs:
            print(ord(a))
        s1 = min(strs)
        s2 = max(strs)
        for i,x in enumerate(s1):
            if x != s2[i]:
                return s2[:i]
        return s1

    def longestCommonPrefix1(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if not strs: return ""
        ss = list(map(set, zip(*strs)))
        for i, x in enumerate(ss):
            x = list(x)
            if len(x) > 1:
                break
        return strs[0][:i]

s = Solution()
print(s.longestCommonPrefix(["abb","abac","aba"]))